package com.grgbanking.it.system.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * 微信菜单
 * 
 * WXMenu
 * 
 * @author 潘广伟
 * @Email p_3er@qq.com
 * @Date 2015-1-8 上午9:12:14
 * 
 * @version 1.0.0
 *
 */
@Entity
@Table(name = "wx_menu", catalog = "it_system")
public class WXMenu implements java.io.Serializable {
	private Integer id;
	private Integer parent;
	private Integer agentId;
	private String type;
	private String name;
	private String key;
	private String url;
	private Integer state;
	private List<WXMenu> children;
	private boolean leaf = true;
	private String iconCls;

	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "agentId")
	public Integer getAgentId() {
		return this.agentId;
	}

	public void setAgentId(Integer agentId) {
		this.agentId = agentId;
	}

	@Column(name = "type", length = 45)
	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Column(name = "name", length = 45)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "key_", length = 45)
	public String getKey() {
		return this.key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	@Column(name = "url")
	public String getUrl() {
		return this.url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	@Column(name = "state")
	public Integer getState() {
		return this.state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	@Column(name = "parent")
	public Integer getParent() {
		return parent;
	}

	public void setParent(Integer parent) {
		this.parent = parent;
	}

	@Transient
	public List<WXMenu> getChildren() {
		return children;
	}

	public void setChildren(List<WXMenu> children) {
		this.children = children;
	}

	@Transient
	public boolean isLeaf() {
		return leaf;
	}

	public void setLeaf(boolean leaf) {
		this.leaf = leaf;
	}

	@Transient
	public String getIconCls() {
		if(leaf){
			iconCls = "child-node";
		}else{
			iconCls = "parent-node";
		}
		
		return iconCls;
	}

	public void setIconCls(String iconCls) {
		this.iconCls = iconCls;
	}
	
	

}